<template>
  <div class="app">
    <h2 class="title">Vue3路由测试</h2>
    <!--导航区-->
    <div class="navigate">
      <RouterLink to="/home" class="nav-link">首页</RouterLink>
      <RouterLink to="/news" class="nav-link">新闻</RouterLink>
      <RouterLink to="/about" class="nav-link">关于</RouterLink>
    </div>
    <!--展示区-->
    <div class="main-content">
      <RouterView></RouterView>
    </div>
  </div>
</template>

<script lang="ts" setup>
  defineOptions({ //宏函数
    name:'App'
  })
  import {RouterView,RouterLink} from 'vue-router'
</script>

<style scoped>
/* App容器 */
.app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  font-family: 'Microsoft YaHei', Arial, sans-serif;
}

/* 标题样式 */
.title {
  text-align: center;
  word-spacing: 5px;
  margin: 30px 0;
  height: 70px;
  line-height: 70px;
  background: linear-gradient(45deg, #667eea 0%, #764ba2 100%);
  border-radius: 15px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  font-size: 30px;
  color: white;
  font-weight: 600;
}

/* 导航容器 */
.navigate {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin: 40px 0;
  flex-wrap: wrap;
}

/* 导航链接 */
.nav-link {
  display: block;
  text-align: center;
  width: 100px;
  height: 45px;
  line-height: 45px;
  border-radius: 25px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  text-decoration: none;
  color: white;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 2px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
  position: relative;
  overflow: hidden;
}

/* 悬停效果 */
.nav-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
  background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

/* 激活状态 */
.nav-link.active {
  background: linear-gradient(135deg, #64967E 0%, #5a8573 100%);
  color: #ffc268;
  font-weight: 700;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* 内容区域 */
.main-content {
  margin: 40px auto 0;
  border-radius: 15px;
  width: 100%;
  max-width: 800px;
  height: 400px;
  border: 2px solid #e0e6ed;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #666;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.main-content:hover {
  border-color: #667eea;
  box-shadow: inset 0 2px 15px rgba(102, 126, 234, 0.1);
}

/* 响应式设计 */
@media (max-width: 768px) {
  .app {
    padding: 10px;
  }

  .title {
    font-size: 24px;
    height: 60px;
    line-height: 60px;
  }

  .navigate {
    gap: 15px;
    margin: 20px 0;
  }

  .nav-link {
    width: 80px;
    height: 40px;
    line-height: 40px;
    font-size: 14px;
  }

  .main-content {
    height: 300px;
    font-size: 16px;
  }
}
</style>

